<template>
  <div class="fb" style="width: 100%">
    <div>
      <Syx-Tag v-if="left.x" @click="tagCli(1)">新增</Syx-Tag>
      <Syx-Tag v-if="left.x1" @click="tagCli(2)" type="success">修改</Syx-Tag>
      <Syx-Tag v-if="left.x2" @click="tagCli(3)" type="danger">删除</Syx-Tag>
      <Syx-Tag v-if="left.x3" @click="tagCli(4)" type="warning">导出</Syx-Tag>
      <Syx-Tag v-if="left.x4" @click="tagCli(5)" type="info">导入</Syx-Tag>
      <slot name="left"></slot>
    </div>
    <div>
      <el-tooltip
        class="item"
        effect="dark"
        :content="`${searchStatus ? '隐藏' : '显示'}搜索项`"
        placement="top"
        v-if="x"
      >
        <el-button
          @click="refreshF"
          icon="el-icon-search"
          size="mini"
          circle
        ></el-button
      ></el-tooltip>
      <el-tooltip
        v-if="x1"
        class="item"
        effect="dark"
        content="刷新"
        placement="top"
      >
        <el-button
          @click="refresh"
          icon="el-icon-refresh"
          size="mini"
          circle
        ></el-button
      ></el-tooltip>
      <slot name="right"></slot>
    </div>
  </div>
</template>

<script>
export default { 
  props: {
    searchStatus: {
      type: Boolean,
      default: () => true,
    },
    from: {
      type: Object,
      default: () => {},
    },
    x: {
      type: Boolean,
      default: () => true,
    },
    x1: {
      type: Boolean,
      default: () => true,
    },
    left: {
      type: Object,
      default: () => ({
        x:true,
        x1:true,
        x2:true,
        x3:true,
        x4:true,
      }),
    },
  },
  methods: {
    tagCli(val){
      this.$emit("tagCli",val);
    },
    refresh() {
      this.$emit("refresh");
    },
    refreshF() {
      this.$emit("update:searchStatus", !this.searchStatus);
      this.$emit("update:from", {});
    },
  },
};
</script>

<style>
.fb {
  display: flex;
  justify-content: space-between;
}
.fb div {
  display: flex;
  align-items: center;
}
.Syx-tag {
  cursor: pointer;
}
</style>
